﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YXShop.IDAL.Shop;
using YXShop.DALFactory;

namespace YXShop.BLL.Shop
{
    public class Shop
    {
        private readonly IShop dal = DataAccess.CreateShop();

        public Shop()
        {
        }

        #region DataBase Operation
        /// <summary>
        ///添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(YXShop.Model.Shop.Shop model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Update(YXShop.Model.Shop.Shop model)
        {
            return dal.Update(model);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        public void Delete(int id)
        {
            dal.Delete(id);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        public void DeleteAll(string ids)
        {
            dal.DeleteAll(ids);
        }
        #endregion

        #region DataBase Load

        /// <summary>
        /// 根据ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public YXShop.Model.Shop.Shop GetModelById(int id)
        {
           return dal.GetModelById(id);
        }
        /// <summary>
        /// 根据条件分页
        /// </summary>
        /// <param name="strWhere">为空 查所有</param>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        public List<YXShop.Model.Shop.Shop> GetListShopByWhere(string where)
        {
            return dal.GetListShopByWhere(where);
        }

        public ChangeHope.DataBase.DataByPage GetList(string orderfield, int pagesize, string Conditions)
        {
            return dal.GetList(orderfield, pagesize, Conditions);
        }
        #endregion
    }
}
